package com.base.controller;

import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.base.po.voip.WeeksAdv;
import com.base.service.WeeksAdvService;

/**
 * 签到广告管理服务端
 * 
 * @author f
 *
 */
@Controller
@RequestMapping("/admin")
public class index_WeeksAdv {

	@Autowired
	private WeeksAdvService weeksAdvService; // 签到广告信息

	// 签到广告首页
	@RequestMapping("/weeksAdvIndex")
	public ModelAndView weeksAdvIndex(HttpServletRequest request) throws Exception {
		String userid = (String) request.getSession().getAttribute("adminUserId"); // 登录的用户ID
		if (userid == null) return new ModelAndView("jsp/loginCheck"); // 未登录
		return new ModelAndView("jsp/index_WeeksAdv", "weadvList",
				weeksAdvService.selectByAll(new WeeksAdv(userid, (byte) 1)));
	}

	// 跳转添加签到广告
	@RequestMapping("/addWeeksAdv")
	public String addWeeksAdv() throws Exception {
		return "jsp/add_WeeksAdv";
	}

	// 跳转修改商圈广告
	@RequestMapping("/updateWeeksAdv")
	public ModelAndView updateWeeksAdv(String id) throws Exception {
		return new ModelAndView("jsp/update_WeeksAdv", "weeksadv", weeksAdvService.selectByPrimaryKey(id));
	}
}
